#include "LinkStack.h"

LinkStack::LinkStack()
{

}

LinkStack::~LinkStack()
{

}

void LinkStack::Push(const ElementType &element)
{
    list.InsertByIndex(0,element);
}

void LinkStack::Pop()
{
    if(list.Size() == 0)
    {
        return;
    }
     list.RemoveByIndex(0);   
}

LinkStack::ElementType *LinkStack::GetTop()
{
    if(list.Size() == 0)
    {
        return nullptr;
    }
    return list.FindByIndex(0);
}

bool LinkStack::IsEmpty()
{
    return list.Size() == 0;
}
